Algorithms

Sorting and Searching Algorithms

Sorting and Searching

Computers use a range of different algorithms to sort and search data. Some algorithms are more efficient than others and some are more suitable for certain types of data. Some examples of sorting algorithms are shown below:


Bubble Sort


Insertion Sort


Searching Algorithms

The simplest type of searching algorithm is the linear search. It involves going through all the pieces of data one by one until it finds the right one; this is very slow and inefficient.

Another method is the binary search algorithm; this works on data that has already been sorted. Every cycle in the binary search algorithm removes half of the remaining possibilities until only the right one is left.